import 'package:flutter/material.dart';

import '../common/image_swiper.dart';
import '../data/mock_data.dart';

class Find extends StatelessWidget {
  const Find({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Container(
          margin: const EdgeInsets.only(left: 5),
          child: const Text("Find", style: TextStyle(color: Colors.black, fontSize: 24, fontWeight: FontWeight.w700)),
        ),
        actions: [
          IconButton(
            onPressed: (){},
            icon: const Icon(Icons.add_circle_outline, size: 24),
          ),
          const SizedBox(width: 10),
        ],
      ),
      body: ListView(
        padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
        children: [
          ImageSwiper(
            images: MockData.imgList.map((item) => Center(child: Image.network(item, fit: BoxFit.cover, width: double.infinity))).toList(),
            borderRadius: BorderRadius.circular(16)
          ),
          const SizedBox(height: 12),
          ...MockData.imgList.map((item) => Container(
            margin: const EdgeInsets.only(bottom: 40),
            child: Column(
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Container(
                      height: 40,
                      width: 40,
                      clipBehavior: Clip.hardEdge,
                      margin: EdgeInsets.only(right: 10),
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(20),
                      ),
                      child: Image.network(item, fit: BoxFit.cover),
                    ),
                    Column(
                      children: [
                        Text("Yuan Jiayi", style: TextStyle(color: Color(0xFF141519), fontSize: 16, fontWeight: FontWeight.w600)),
                        SizedBox(height: 4),
                        Text("2022-05-12", style: TextStyle(color: Color(0xFF8C8C8C), fontSize: 12, fontWeight: FontWeight.w300)),
                      ],
                    ),
                    Expanded(
                      flex: 1,
                      child: SizedBox(),
                    ),
                    // Flex(direction: Axis.horizontal),
                    TextButton.icon(
                      onPressed: () {},
                      style: ButtonStyle(
                        padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 4)),
                      ),
                      icon: Icon(Icons.add),
                      label: const Text("Follow", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.black)),
                    ),
                  ],
                ),
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text("The world's richest people all become rich by investing in a single stock.",
                      maxLines: 2,
                      overflow: TextOverflow.ellipsis,
                      style: TextStyle(
                        fontSize: 16,
                        fontWeight: FontWeight.w500,
                        color: Color(0xFF141519),
                      ),
                    ),
                    Container(
                      width: 165,
                      height: 165,
                      margin: EdgeInsets.symmetric(vertical: 12),
                      decoration: BoxDecoration(
                        image: DecorationImage(
                          image: NetworkImage(item),
                          fit: BoxFit.cover,
                        ),
                        borderRadius: BorderRadius.circular(8)
                      ),
                    ),
                  ],
                ),
                // 底部按钮
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    TextButton.icon(
                      onPressed: () {},
                      style: ButtonStyle(
                        padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 4)),
                      ),
                      icon: Icon(Icons.send, color: Color(0xFF141519)),
                      label: Text("Transmit", style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF141519)))
                    ),
                    TextButton.icon(
                        onPressed: () {},
                        style: ButtonStyle(
                          padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 4)),
                        ),
                        icon: Icon(Icons.insert_comment, color: Color(0xFF141519)),
                        label: Text("4", style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Color(0xFF141519)))
                    ),
                    TextButton.icon(
                        onPressed: () {},
                        style: ButtonStyle(
                          padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 4)),
                        ),
                        icon: Icon(Icons.favorite, color: Color(0xFFF5222D)),
                        label: Text("99", style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Color(0xFFF5222D)))
                    ),
                  ],
                ),
                Divider(color: Color(0xFFF0F0F0))
              ],
            ),
          )).toList(),
        ],
      ),
    );
  }
}
